﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Pharmacy.BusinessEntities;

namespace Pharmacy.Repository.Mapping
{
    public class CategoriaMap:EntityTypeConfiguration<Categoria>
    {
        public CategoriaMap()
        {
            this.HasKey(p => p.Id);

            this.Property(p => p.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(p => p.Nombre)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(p => p.Descripcion)
                .IsOptional()
                .HasMaxLength(200);

            this.ToTable("CATEGORIA");

            this.Property(p => p.Id).HasColumnName("Id");
            this.Property(p => p.Nombre).HasColumnName("Nombre");
            this.Property(p => p.Descripcion).HasColumnName("Descripcion");

        }
    }
}
